<?php

namespace app\common\model;

use think\Model;

class LiveRoomManagerModel extends Model
{
    protected $connection = 'db_live';

    public function user()
    {
        return $this->hasOne('UserModel', 'id', 'mgrid')->with('profile')->field("id, nick_name, avatar, is_anchor");
    }

    public function anchor()
    {
        return $this->hasOne('UserModel', 'id', 'anchorid')->with('profile')->field("id, nick_name, avatar, is_anchor");
    }

    public function userinfo()
    {
        return $this->hasOne(UserModel::class, 'id', 'mgrid')->field('id, nick_name, avatar');
    }

    public function chatUsers()
    {
        return $this->hasMany(MgrChatModel::class, 'mgr_id', 'mgrid');
    }

}